<?php

namespace app\v1\controller;
use support\Request;
use app\model\CityModel;
use app\model\Util;

class CityController {
    

    public function index(Request $request){
        $data = CityModel::whereNull('deleted_at')->get();

        foreach($data as &$item){
            $item['image_url'] = Util::pathToUrl($item->image);
        }

        return json([
            'code' => 1,
            'data' => $data,
        ]);
    }
}
